home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / VideoToolbox 96.06.15 / (Notes) / Numerical Recipes v 2.doc < prev    next >
Text File  |  1996-01-23  |  2KB  |  31 lines

  1. VideoToolbox: "Improve Numerical Recipes v 2.note"
  2. June 15, 1993; revised January 23, 1996
  3.  
  4. Numerical Recipes C Diskette for Macintosh, 2nd ed. $31.96 (software)
  5. Numerical Recipes in C: The Art of Scientific Computing, 2nd ed. $39.96 (book)
  6. OR
  7. Numerical Recipes C Set for Macintosh (main book, example book, and disk) $90
  8. Useful book and mathematical library in source form, so you can read the code, understand what’s going on, and modify it if necessary. From:
  9. Cambridge University Press
  10. 40 West 20th Street
  11. New York, NY 10010-4211
  12. (800)-227-0247
  13. http://nr.harvard.edu/nr/store/storefront.html
  14.  
  15. The VideoToolbox routines that use the recipes assume that you have made the following five changes to the Numerical Recipes in C routines: 
  16. 1A. If you care about speed when compiled to run on 68k macs with floating point units: In every file, change every "float" to "FLOAT", and insert the line "#include <nr.h>" at the beginning of the file. Insert these statements
  17. #if GENERATING68K && GENERATING68881
  18.     typedef double FLOAT;
  19. #else
  20.     typedef float FLOAT;
  21. #endif
  22. into the file nr.h. This is because 68k+fpu Macs compute doubles much faster than floats, whereas the reverse is true on most computers, including the PowerPC Macs.
  23. 1B. Alternatively, if you'd rather run slowly than modify your Numerical Recipes files, then you will need to insert  "typedef float FLOAT;"  in CalibrateLuminance.c and PsychometricFit.c in order to compile those files. The rest of the VideoToolbox doesn't care.
  24. 2. Add #include "nrutil.h" as second line of nrutil.c.
  25. 3. Add "#pragma once" at the top of nr.h and nrutil.h. This will allow you to include these headers freely in your THINK C files, without worrying about whether you've inadvertently included them twice.
  26. 4. In order to produce reasonable polynomial fits it is necessary to reduce the TOL parameter in the file SVDFIT.C to a small value, e.g. 1.0e-14. Otherwise the fits will not be very good, and will have the nonintuitive property that the fit will get WORSE as the order of the polynomial is increased.
  27. 5. I like to include the precompiled header VideoToolbox.h in a prefix line for my whole project. This causes it to be included in the Numerical Recipes files, which don't need it. The only conflict I've found is that PI is defined both in VideoToolbox.h and in BNLDEV.C, which I fixed by first undefining it in BNLDEV.c:
  28. #undef PI        /* added by dgp, for compatibility with VideoToolbox.h */
  29. #define PI 3.141592654
  30.  
  31.